Skip to content

fix(cloudflare,deno): Remove false-positive text/plain streaming classification#20210

Closed
Copilot wants to merge 2 commits intodevelopfrom
copilot/investigate-flaky-ci-test
Closed

fix(cloudflare,deno): Remove false-positive text/plain streaming classification#20210
Copilot wants to merge 2 commits intodevelopfrom
copilot/investigate-flaky-ci-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

classifyResponseStreaming classified text/plain without Content-Length as streaming. Since new Response('any string') auto-sets text/plain;charset=UTF-8 without Content-Length, every simple text response hit the streaming code path — tee + monitor stream + deferred span end/flush instead of immediate span end/flush.

This caused flaky timeouts in the Cloudflare WorkerEntrypoint E2E test: the Durable Object's new Response('Stored') was misclassified as streaming, deferring the transaction flush through a chain of tee operations between DO and Worker contexts. Under load (test:prod run), the deferred flush occasionally didn't complete within the 30s test timeout.

Changes

  • packages/cloudflare/src/utils/streaming.ts: Remove the text/plain without Content-Length heuristic. Only known streaming content types remain: text/event-stream, application/ndjson, application/stream+json.
  • packages/deno/src/utils/streaming.ts: Same fix for consistency (identical classification logic).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.deno.land
    • Triggering command: /usr/bin/curl curl -s REDACTED git fetc�� origin develop ndor/bin/bash (dns block)
  • dsn.ingest.sentry.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local es/.bin/run-s user.email (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local '~E_ALL' committer.email all("session") as $k => $v) echo/proc/cpuinfo (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local de/node/bin/node gpg.program (dns block)
  • fastdl.mongodb.org
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node ./postinstall.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 10, 2026 that may be closed by this pull request
…lassification

The `classifyResponseStreaming` function classified `text/plain` responses
without a `Content-Length` header as streaming. This heuristic was too
aggressive because `new Response('some text')` creates a `text/plain`
response without Content-Length, causing simple non-streaming responses
to take the streaming code path.

In the streaming path, the span end and transaction flush are delayed
until a stream monitor completes, which can cause timing issues when
the response is passed between Durable Objects and Workers in the
Cloudflare runtime, leading to flaky test timeouts.

Removing this rule ensures simple text/plain responses are processed
through the non-streaming (immediate span end + flush) code path.
Known streaming content types (SSE, NDJSON, JSON streaming) are still
correctly detected.

Fixes #20209

Co-Authored-By: Claude <noreply@anthropic.com>

Agent-Logs-Url: https://github.com/getsentry/sentry-javascript/sessions/b58267a8-c6d6-4fc0-b4fb-82b5843bbf70

Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate cloudflare workers entrypoint test flakiness fix(cloudflare,deno): Remove false-positive text/plain streaming classification Apr 10, 2026
Copilot AI requested a review from Lms24 April 10, 2026 14:34
@Lms24
Copy link
Copy Markdown
Member

Lms24 commented Apr 10, 2026

surfaced via #20209

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Core

  • Add enableTruncation option to Google GenAI integration by andreiborza in #20184
  • Add enableTruncation option to Anthropic AI integration by andreiborza in #20181
  • Add enableTruncation option to LangGraph integration by andreiborza in #20183
  • Add enableTruncation option to LangChain integration by andreiborza in #20182
  • Add enableTruncation option to OpenAI integration by andreiborza in #20167
  • Export a reusable function to add tracing headers by JPeer264 in #20076

Deps

  • Bump axios from 1.13.5 to 1.15.0 by dependabot in #20180
  • Bump hono from 4.12.7 to 4.12.12 by dependabot in #20118
  • Bump defu from 6.1.4 to 6.1.6 by dependabot in #20104

Other

  • (cloudflare) Propagate traceparent to RPC calls - via fetch by JPeer264 in #19991

Bug Fixes 🐛

  • (cloudflare,deno) Remove false-positive text/plain streaming classification by Copilot in #20210
  • (deno) Avoid inferring invalid span op from Deno tracer by Lms24 in #20128
  • (e2e) Add op check to waitForTransaction in React Router e2e tests by copilot-swe-agent in #20193

Internal Changes 🔧

Deps

  • Bump hono from 4.12.7 to 4.12.12 in /dev-packages/e2e-tests/test-applications/cloudflare-hono by dependabot in #20119
  • Bump axios from 1.13.5 to 1.15.0 in /dev-packages/e2e-tests/test-applications/nestjs-basic by dependabot in #20179

Other

  • (bugbot) Add rules to flag test-flake-provoking patterns by Lms24 in #20192
  • (deps-dev) Bump vite from 7.2.0 to 7.3.2 in /dev-packages/e2e-tests/test-applications/tanstackstart-react by dependabot in #20107
  • (react) Remove duplicated test mock by s1gr1d in #20200
  • (size-limit) Bump failing size limit scenario by Lms24 in #20186

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.72 kB - -
@sentry/browser - with treeshaking flags 24.21 kB - -
@sentry/browser (incl. Tracing) 42.73 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.35 kB - -
@sentry/browser (incl. Tracing, Replay) 81.54 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.11 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.25 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.45 kB - -
@sentry/browser (incl. Feedback) 42.51 kB - -
@sentry/browser (incl. sendFeedback) 30.39 kB - -
@sentry/browser (incl. FeedbackAsync) 35.38 kB - -
@sentry/browser (incl. Metrics) 27.04 kB - -
@sentry/browser (incl. Logs) 27.18 kB - -
@sentry/browser (incl. Metrics & Logs) 27.86 kB - -
@sentry/react 27.48 kB - -
@sentry/react (incl. Tracing) 45.05 kB - -
@sentry/vue 30.56 kB - -
@sentry/vue (incl. Tracing) 44.59 kB - -
@sentry/svelte 25.74 kB - -
CDN Bundle 28.41 kB - -
CDN Bundle (incl. Tracing) 43.75 kB - -
CDN Bundle (incl. Logs, Metrics) 29.78 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.59 kB - -
CDN Bundle (incl. Tracing, Replay) 80.64 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.66 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 86.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 87.2 kB - -
CDN Bundle - uncompressed 82.99 kB - -
CDN Bundle (incl. Tracing) - uncompressed 129.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 133.19 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 210.12 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 246.65 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 250.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 259.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 262.95 kB - -
@sentry/nextjs (client) 47.47 kB - -
@sentry/sveltekit (client) 43.2 kB - -
@sentry/node-core 57.86 kB +0.02% +7 B 🔺
@sentry/node 174.86 kB +0.03% +42 B 🔺
@sentry/node - without tracing 97.97 kB +0.03% +22 B 🔺
@sentry/aws-serverless 115.22 kB +0.02% +19 B 🔺

View base workflow run

@Lms24
Copy link
Copy Markdown
Member

Lms24 commented Apr 10, 2026

I'm a bit suspicious about this. not sure if this could really prolong a span for 30s+.

@Lms24
Copy link
Copy Markdown
Member

Lms24 commented Apr 10, 2026

nah that sounds a bit esoteric. Don'T think this would account for 30s delays

@Lms24 Lms24 closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky CI]: Cloudflare WorkerEntrypoint spans

2 participants